const state = () => ({
    currentTabIndex: 0,
    tabList: [{
            icon: "tabbar-home",
            selectIcon: "tabbar-home_full",
            text: "首页",
            pagePath: "/pages/tabbar/index",
            badge: null,
            badgeDot: false
        },
        {
            icon: "tabbar-category",
            selectIcon: "tabbar-category_full",
            pagePath: "/pages/tabbar/category",
            text: "分类",
            badge: null,
            badgeDot: false
        },
        {
            icon: "tabbar-cart",
            selectIcon: "tabbar-cart_full",
            pagePath: "/pages/tabbar/cart",
            text: "购物车",
            badge: null,
            badgeDot: false
        },
        {
            icon: "tabbar-me",
            selectIcon: "tabbar-me_full",
            pagePath: "/pages/tabbar/user",
            text: "我的",
            badge: null,
            badgeDot: false 
        }
    ]
})


const mutations = {
    /**
     *  更新一条tabbar数据
     * @param { Object } state // vuex state
     * @param { Number } index // 需要更新的索引
     */
    updateCurrentTabIndex(state, index) {
        state.currentTabIndex = index;
    },

    /**
     *  更新tabList数据
     * @param { Object } state // vuex state
     */
    updateTabBarList(state, provider) {
        state.tabList = provider;
    },
}


export default {
    namespaced: true,
    state,
    mutations
}